From 36eccd816f5b635cd17b93cd171da77382289967 Mon Sep 17 00:00:00 2001 From: Federico Mena Quintero Date: Mon, 13 Oct 2003 19:59:37 +0000 Subject: [PATCH] Walk the whole shortcuts model, not just the bookmarks part --- there is 2003-10-13 Federico Mena Quintero * gtkfilechooserimpldefault.c (check_bookmarks_sensitivity): Walk the whole shortcuts model, not just the bookmarks part --- there is no need to add bookmarks for "stock" volume items. (gtk_file_chooser_impl_default_set_property): Oops, hide/show the tree/list as appropriate for the folder_mode property. --- gtk/gtkfilechooserdefault.c | 38 ++++++++++++++++++++----------------- 1 file changed, 21 insertions(+), 17 deletions(-) diff --git a/gtk/gtkfilechooserdefault.c b/gtk/gtkfilechooserdefault.c index 2de5855b96..ad963c167d 100644 --- a/gtk/gtkfilechooserdefault.c +++ b/gtk/gtkfilechooserdefault.c @@ -1017,9 +1017,15 @@ gtk_file_chooser_impl_default_set_property (GObject *object, { impl->folder_mode = folder_mode; if (impl->folder_mode) - gtk_widget_hide (impl->list_scrollwin); + { + gtk_widget_hide (impl->list_scrollwin); + gtk_widget_show (impl->tree_scrollwin); + } else - gtk_widget_show (impl->list_scrollwin); + { + gtk_widget_hide (impl->tree_scrollwin); + gtk_widget_show (impl->list_scrollwin); + } } } break; @@ -1342,32 +1348,30 @@ update_chooser_entry (GtkFileChooserImplDefault *impl) static void check_bookmarks_sensitivity (GtkFileChooserImplDefault *impl) { - GtkTreeIter *iter; + GtkTreeIter iter; gboolean exists; if (!gtk_file_system_get_supports_bookmarks (impl->file_system)) return; - iter = gtk_tree_iter_copy (&impl->bookmarks_iter); - exists = FALSE; - while (gtk_tree_model_iter_next (GTK_TREE_MODEL (impl->shortcuts_model), iter)) - { - GtkFilePath *path; + if (gtk_tree_model_get_iter_first (GTK_TREE_MODEL (impl->shortcuts_model), &iter)) + do + { + GtkFilePath *path; - gtk_tree_model_get (GTK_TREE_MODEL (impl->shortcuts_model), iter, SHORTCUTS_COL_PATH, &path, -1); - g_assert (path != NULL); + gtk_tree_model_get (GTK_TREE_MODEL (impl->shortcuts_model), &iter, SHORTCUTS_COL_PATH, &path, -1); - if (gtk_file_path_compare (path, impl->current_folder) == 0) - { - exists = TRUE; - break; - } - } + if (path && gtk_file_path_compare (path, impl->current_folder) == 0) + { + exists = TRUE; + break; + } + } + while (gtk_tree_model_iter_next (GTK_TREE_MODEL (impl->shortcuts_model), &iter)); gtk_widget_set_sensitive (impl->add_bookmark_button, !exists); - gtk_tree_iter_free (iter); } static void -- 2.30.2